<?php

use think\migration\Migrator;
use think\migration\db\Column;

class InitMenu extends Migrator
{
    /**
     * Change Method.
     *
     * Write your reversible migrations using this method.
     *
     * More information on writing migrations is available here:
     * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
     *
     * The following commands can be used in this method and Phinx will
     * automatically reverse them when rolling back:
     *
     *    createTable
     *    renameTable
     *    addColumn
     *    renameColumn
     *    addIndex
     *    addForeignKey
     *
     * Remember to call "create()" or "update()" and NOT "save()" when working
     * with the Table class.
     */
    public function up()
    {
        $data = [
            ['id'=>1,'title'=>'用户登录','fid'=>0,'url'=>'admin/Login/index','auth'=>0,'sort'=>0,'show'=>0,'icon'=>'','level'=>0,'component'=>'','router'=>''],
            ['id'=>2,'title'=>'用户登出','fid'=>0,'url'=>'admin/Login/logout','auth'=>0,'sort'=>0,'show'=>0,'icon'=>'','level'=>0,'component'=>'','router'=>''],
            ['id'=>3,'title'=>'系统管理','fid'=>0,'url'=>'','auth'=>0,'sort'=>1,'show'=>1,'icon'=>'','level'=>0,'component'=>'','router'=>''],
            ['id'=>4,'title'=>'应用管理','fid'=>0,'url'=>'','auth'=>0,'sort'=>2,'show'=>1,'icon'=>'','level'=>0,'component'=>'','router'=>''],
            ['id'=>5,'title'=>'接口管理','fid'=>0,'url'=>'','auth'=>0,'sort'=>3,'show'=>1,'icon'=>'','level'=>0,'component'=>'','router'=>''],
            ['id'=>6,'title'=>'菜单维护','fid'=>3,'url'=>'','auth'=>0,'sort'=>1,'show'=>1,'icon'=>'','level'=>0,'component'=>'','router'=>''],
            ['id'=>7,'title'=>'权限管理','fid'=>3,'url'=>'','auth'=>0,'sort'=>2,'show'=>1,'icon'=>'','level'=>0,'component'=>'','router'=>''],
        ];

        $this->table('menu')->insert($data)->saveData();

    }
}
